from flask import Flask

from models import db


def init_app(app: Flask):
    app.config.from_mapping(
        SQLALCHEMY_DATABASE_URI=app.config.get('SQLALCHEMY_DATABASE_URI'),
        SQLALCHEMY_BINDS=app.config.get('SQLALCHEMY_BINDS'),
        SQLALCHEMY_ENGINE_OPTIONS=app.config.get('SQLALCHEMY_ENGINE_OPTIONS'),
        SQLALCHEMY_ECHO=app.config.get('SQLALCHEMY_ECHO'),
    )

    db.init_app(app)
